import 'package:expandable_text/expandable_text.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:smart_devices/bruno/src/components/button/brn_normal_button.dart';
import 'package:smart_devices/ui/draw_under_line.dart';
import 'package:smart_devices/utils/colors.dart';
import 'package:smart_devices/utils/styles.dart';

import 'maintained_logic.dart';

class DeviceMaintainedView extends GetView<DeviceMaintainedLogic> {
  const DeviceMaintainedView({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GetBuilder<DeviceMaintainedLogic>(
      builder: (_) {
        return Obx(() => Scaffold(
              backgroundColor:
                  ColorsUtils.parseColorFromHexString(ColorsUtils.colorF6f6),
              appBar: AppBar(
                leading: IconButton(
                  icon: const Icon(
                    Icons.arrow_back_ios,
                    color: Colors.white,
                    size: 15,
                  ),
                  onPressed: Get.back,
                ),
                automaticallyImplyLeading: false,
                backgroundColor:
                    ColorsUtils.parseColorFromHexString(ColorsUtils.color0052),
                title: Text(
                  '已保养项目(${controller.count.value})',
                  style: StylesUtils.customTextStyle(
                      fontSize: 18, fontWeight: FontWeight.w700),
                ),
                centerTitle: true,
                systemOverlayStyle: SystemUiOverlayStyle.dark,
              ),
              body: SingleChildScrollView(
                padding: const EdgeInsets.only(bottom: 50),
                child: Column(
                  children: [
                    DrawUnderLine(
                        child: Container(
                      margin: const EdgeInsets.only(top: 15),
                      padding: const EdgeInsets.only(left: 20, right: 15),
                      color: Colors.white,
                      child: ListBody(
                        children: [
                          SizedBox(
                            height: 40,
                            child: Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: [
                                Text(
                                  '充电器插头保养',
                                  style: StylesUtils.customTextStyle(
                                      fontSize: 15,
                                      color: ColorsUtils.color4950,
                                      fontWeight: FontWeight.w700),
                                ),
                                BrnNormalButton(
                                  onTap: () {},
                                  constraints: const BoxConstraints.expand(
                                      width: 80, height: 25),
                                  text: '二级保养',
                                  textStyle: StylesUtils.customTextStyle(
                                      fontSize: 12,
                                      color: ColorsUtils.color0052),
                                  decoration: BoxDecoration(
                                    border: Border.all(
                                      color:
                                          ColorsUtils.parseColorFromHexString(
                                              ColorsUtils.color0052),
                                    ),
                                  ),
                                )
                              ],
                            ),
                          ),
                          Container(
                            height: 30,
                            alignment: Alignment.centerLeft,
                            child: Text.rich(TextSpan(children: [
                              TextSpan(
                                  text: '保养部位：',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color3333,
                                      fontSize: 13)),
                              TextSpan(
                                  text: '底部滑轮',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.colorAaaa,
                                      fontSize: 13))
                            ])),
                          ),
                          Container(
                            height: 30,
                            alignment: Alignment.centerLeft,
                            child: Text.rich(TextSpan(children: [
                              TextSpan(
                                  text: '保养要求：',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color3333,
                                      fontSize: 13)),
                              TextSpan(
                                  text: '是否磨损，功能是否正常',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.colorAaaa,
                                      fontSize: 13))
                            ])),
                          ),
                          Container(
                            height: 30,
                            alignment: Alignment.centerLeft,
                            child: Text.rich(TextSpan(children: [
                              TextSpan(
                                  text: '保 养 人：',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color3333,
                                      fontSize: 13)),
                              TextSpan(
                                  text: '付蓉',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.colorAaaa,
                                      fontSize: 13))
                            ])),
                          ),
                          Container(
                            height: 30,
                            alignment: Alignment.centerLeft,
                            child: Text.rich(TextSpan(children: [
                              TextSpan(
                                  text: '类  型：',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color3333,
                                      fontSize: 13)),
                              TextSpan(
                                  text: '负责人',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.colorAaaa,
                                      fontSize: 13))
                            ])),
                          ),
                          Container(
                            constraints: const BoxConstraints(minHeight: 30),
                            alignment: Alignment.centerLeft,
                            child: Row(
                                mainAxisAlignment: MainAxisAlignment.start,
                                crossAxisAlignment: CrossAxisAlignment.start,
                                verticalDirection: VerticalDirection.down,
                                children: [
                                  Container(
                                    alignment: Alignment.centerLeft,
                                    child: Text('备  注：',
                                        style: StylesUtils.customTextStyle(
                                            color: ColorsUtils.color3333,
                                            fontSize: 13)),
                                  ),
                                  Flexible(
                                      fit: FlexFit.tight,
                                      child: Container(
                                        alignment: Alignment.topLeft,
                                        child: ExpandableText(
                                            '睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋',
                                            maxLines: 1,
                                            textAlign: TextAlign.left,
                                            textDirection: TextDirection.ltr,
                                            style: StylesUtils.customTextStyle(
                                                color: ColorsUtils.colorAaaa,
                                                fontSize: 13,
                                                lineHeight: 2),
                                            onExpandedChanged: (bool flag) {},
                                            collapseText: '收起',
                                            expandText: '展开'),
                                      ))
                                ]),
                          )
                        ],
                      ),
                    )),
                    DrawUnderLine(
                        child: Container(
                      margin: const EdgeInsets.only(top: 15),
                      padding: const EdgeInsets.only(left: 20, right: 15),
                      color: Colors.white,
                      child: ListBody(
                        children: [
                          SizedBox(
                            height: 40,
                            child: Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: [
                                Text(
                                  '充电器插头保养',
                                  style: StylesUtils.customTextStyle(
                                      fontSize: 15,
                                      color: ColorsUtils.color4950,
                                      fontWeight: FontWeight.w700),
                                ),
                                BrnNormalButton(
                                  onTap: () {},
                                  insertPadding: const EdgeInsets.only(top: 2),
                                  constraints: const BoxConstraints.expand(
                                      width: 80, height: 25),
                                  text: '二级保养',
                                  textStyle: StylesUtils.customTextStyle(
                                      fontSize: 12,
                                      color: ColorsUtils.color0052),
                                  decoration: BoxDecoration(
                                      border: Border.all(
                                    color: ColorsUtils.parseColorFromHexString(
                                        ColorsUtils.color0052),
                                  )),
                                )
                              ],
                            ),
                          ),
                          Container(
                            height: 30,
                            alignment: Alignment.centerLeft,
                            child: Text.rich(TextSpan(children: [
                              TextSpan(
                                  text: '保养部位：',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color3333,
                                      fontSize: 13)),
                              TextSpan(
                                  text: '底部滑轮',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.colorAaaa,
                                      fontSize: 13))
                            ])),
                          ),
                          Container(
                            height: 30,
                            alignment: Alignment.centerLeft,
                            child: Text.rich(TextSpan(children: [
                              TextSpan(
                                  text: '保养要求：',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color3333,
                                      fontSize: 13)),
                              TextSpan(
                                  text: '是否磨损，功能是否正常',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.colorAaaa,
                                      fontSize: 13))
                            ])),
                          ),
                          Container(
                            height: 30,
                            alignment: Alignment.centerLeft,
                            child: Text.rich(TextSpan(children: [
                              TextSpan(
                                  text: '保 养 人：',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color3333,
                                      fontSize: 13)),
                              TextSpan(
                                  text: '付蓉',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.colorAaaa,
                                      fontSize: 13))
                            ])),
                          ),
                          Container(
                            height: 30,
                            alignment: Alignment.centerLeft,
                            child: Text.rich(TextSpan(children: [
                              TextSpan(
                                  text: '类  型：',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color3333,
                                      fontSize: 13)),
                              TextSpan(
                                  text: '负责人',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.colorAaaa,
                                      fontSize: 13))
                            ])),
                          ),
                          Container(
                            constraints: const BoxConstraints(minHeight: 30),
                            alignment: Alignment.centerLeft,
                            child: Row(
                                mainAxisAlignment: MainAxisAlignment.start,
                                crossAxisAlignment: CrossAxisAlignment.start,
                                verticalDirection: VerticalDirection.down,
                                children: [
                                  Container(
                                    alignment: Alignment.centerLeft,
                                    child: Text('备  注：',
                                        style: StylesUtils.customTextStyle(
                                            color: ColorsUtils.color3333,
                                            fontSize: 13)),
                                  ),
                                  Flexible(
                                      fit: FlexFit.tight,
                                      child: Container(
                                        alignment: Alignment.topLeft,
                                        child: ExpandableText(
                                            '睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋',
                                            maxLines: 1,
                                            textAlign: TextAlign.left,
                                            textDirection: TextDirection.ltr,
                                            style: StylesUtils.customTextStyle(
                                                color: ColorsUtils.colorAaaa,
                                                fontSize: 13,
                                                lineHeight: 2),
                                            onExpandedChanged: (bool flag) {},
                                            collapseText: '收起',
                                            expandText: '展开'),
                                      ))
                                ]),
                          )
                        ],
                      ),
                    )),
                    DrawUnderLine(
                        child: Container(
                      margin: const EdgeInsets.only(top: 15),
                      padding: const EdgeInsets.only(left: 20, right: 15),
                      color: Colors.white,
                      child: ListBody(
                        children: [
                          SizedBox(
                            height: 40,
                            child: Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: [
                                Text(
                                  '充电器插头保养',
                                  style: StylesUtils.customTextStyle(
                                      fontSize: 15,
                                      color: ColorsUtils.color4950,
                                      fontWeight: FontWeight.w700),
                                ),
                                BrnNormalButton(
                                  onTap: () {},
                                  insertPadding: const EdgeInsets.only(top: 2),
                                  constraints: const BoxConstraints.expand(
                                      width: 80, height: 25),
                                  text: '二级保养',
                                  textStyle: StylesUtils.customTextStyle(
                                      fontSize: 12,
                                      color: ColorsUtils.color0052),
                                  decoration: BoxDecoration(
                                      border: Border.all(
                                    color: ColorsUtils.parseColorFromHexString(
                                        ColorsUtils.color0052),
                                  )),
                                )
                              ],
                            ),
                          ),
                          Container(
                            height: 30,
                            alignment: Alignment.centerLeft,
                            child: Text.rich(TextSpan(children: [
                              TextSpan(
                                  text: '保养部位：',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color3333,
                                      fontSize: 13)),
                              TextSpan(
                                  text: '底部滑轮',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.colorAaaa,
                                      fontSize: 13))
                            ])),
                          ),
                          Container(
                            height: 30,
                            alignment: Alignment.centerLeft,
                            child: Text.rich(TextSpan(children: [
                              TextSpan(
                                  text: '保养要求：',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color3333,
                                      fontSize: 13)),
                              TextSpan(
                                  text: '是否磨损，功能是否正常',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.colorAaaa,
                                      fontSize: 13))
                            ])),
                          ),
                          Container(
                            height: 30,
                            alignment: Alignment.centerLeft,
                            child: Text.rich(TextSpan(children: [
                              TextSpan(
                                  text: '保 养 人：',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color3333,
                                      fontSize: 13)),
                              TextSpan(
                                  text: '付蓉',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.colorAaaa,
                                      fontSize: 13))
                            ])),
                          ),
                          Container(
                            height: 30,
                            alignment: Alignment.centerLeft,
                            child: Text.rich(TextSpan(children: [
                              TextSpan(
                                  text: '类  型：',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color3333,
                                      fontSize: 13)),
                              TextSpan(
                                  text: '负责人',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.colorAaaa,
                                      fontSize: 13))
                            ])),
                          ),
                          Container(
                            constraints: const BoxConstraints(minHeight: 30),
                            alignment: Alignment.centerLeft,
                            child: Row(
                                mainAxisAlignment: MainAxisAlignment.start,
                                crossAxisAlignment: CrossAxisAlignment.start,
                                verticalDirection: VerticalDirection.down,
                                children: [
                                  Container(
                                    alignment: Alignment.centerLeft,
                                    child: Text('备  注：',
                                        style: StylesUtils.customTextStyle(
                                            color: ColorsUtils.color3333,
                                            fontSize: 13)),
                                  ),
                                  Flexible(
                                      fit: FlexFit.tight,
                                      child: Container(
                                        alignment: Alignment.topLeft,
                                        child: ExpandableText(
                                            '睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋',
                                            maxLines: 1,
                                            textAlign: TextAlign.left,
                                            textDirection: TextDirection.ltr,
                                            style: StylesUtils.customTextStyle(
                                                color: ColorsUtils.colorAaaa,
                                                fontSize: 13,
                                                lineHeight: 2),
                                            onExpandedChanged: (bool flag) {},
                                            collapseText: '收起',
                                            expandText: '展开'),
                                      ))
                                ]),
                          )
                        ],
                      ),
                    )),
                    DrawUnderLine(
                        child: Container(
                      margin: const EdgeInsets.only(top: 15),
                      padding: const EdgeInsets.only(left: 20, right: 15),
                      color: Colors.white,
                      child: ListBody(
                        children: [
                          SizedBox(
                            height: 40,
                            child: Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: [
                                Text(
                                  '充电器插头保养',
                                  style: StylesUtils.customTextStyle(
                                      fontSize: 15,
                                      color: ColorsUtils.color4950,
                                      fontWeight: FontWeight.w700),
                                ),
                                BrnNormalButton(
                                  onTap: () {},
                                  insertPadding: const EdgeInsets.only(top: 2),
                                  constraints: const BoxConstraints.expand(
                                      width: 80, height: 25),
                                  text: '二级保养',
                                  textStyle: StylesUtils.customTextStyle(
                                      fontSize: 12,
                                      color: ColorsUtils.color0052),
                                  decoration: BoxDecoration(
                                      border: Border.all(
                                    color: ColorsUtils.parseColorFromHexString(
                                        ColorsUtils.color0052),
                                  )),
                                )
                              ],
                            ),
                          ),
                          Container(
                            height: 30,
                            alignment: Alignment.centerLeft,
                            child: Text.rich(TextSpan(children: [
                              TextSpan(
                                  text: '保养部位：',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color3333,
                                      fontSize: 13)),
                              TextSpan(
                                  text: '底部滑轮',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.colorAaaa,
                                      fontSize: 13))
                            ])),
                          ),
                          Container(
                            height: 30,
                            alignment: Alignment.centerLeft,
                            child: Text.rich(TextSpan(children: [
                              TextSpan(
                                  text: '保养要求：',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color3333,
                                      fontSize: 13)),
                              TextSpan(
                                  text: '是否磨损，功能是否正常',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.colorAaaa,
                                      fontSize: 13))
                            ])),
                          ),
                          Container(
                            height: 30,
                            alignment: Alignment.centerLeft,
                            child: Text.rich(TextSpan(children: [
                              TextSpan(
                                  text: '保 养 人：',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color3333,
                                      fontSize: 13)),
                              TextSpan(
                                  text: '付蓉',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.colorAaaa,
                                      fontSize: 13))
                            ])),
                          ),
                          Container(
                            height: 30,
                            alignment: Alignment.centerLeft,
                            child: Text.rich(TextSpan(children: [
                              TextSpan(
                                  text: '类  型：',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color3333,
                                      fontSize: 13)),
                              TextSpan(
                                  text: '负责人',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.colorAaaa,
                                      fontSize: 13))
                            ])),
                          ),
                          Container(
                            constraints: const BoxConstraints(minHeight: 30),
                            alignment: Alignment.centerLeft,
                            child: Row(
                                mainAxisAlignment: MainAxisAlignment.start,
                                crossAxisAlignment: CrossAxisAlignment.start,
                                verticalDirection: VerticalDirection.down,
                                children: [
                                  Container(
                                    alignment: Alignment.centerLeft,
                                    child: Text('备  注：',
                                        style: StylesUtils.customTextStyle(
                                            color: ColorsUtils.color3333,
                                            fontSize: 13)),
                                  ),
                                  Flexible(
                                      fit: FlexFit.tight,
                                      child: Container(
                                        alignment: Alignment.topLeft,
                                        child: ExpandableText(
                                            '睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋睡觉睡到自然醒，数钱数到手抽筋',
                                            maxLines: 1,
                                            textAlign: TextAlign.left,
                                            textDirection: TextDirection.ltr,
                                            style: StylesUtils.customTextStyle(
                                                color: ColorsUtils.colorAaaa,
                                                fontSize: 13,
                                                lineHeight: 2),
                                            onExpandedChanged: (bool flag) {},
                                            collapseText: '收起',
                                            expandText: '展开'),
                                      ))
                                ]),
                          )
                        ],
                      ),
                    ))
                  ],
                ),
              ),
            ));
      },
      init: controller,
    );
  }
}
